package com.wlcj.www.util;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class Lang {
	
	public static final int DEFAULT_PRECISION = 2;
	
	public static String formatMoney(BigDecimal b, int len) {
		return b.setScale(len, RoundingMode.HALF_DOWN).toString();
	}
	
	public static String formatMoney(BigDecimal b) {
		return formatMoney(b, DEFAULT_PRECISION);
	}
	
	public static String formatMoney(double b, int len) {
		return formatMoney(new BigDecimal(b), len);
	}
	
	public static String formatMoney(double b) {
		return formatMoney(new BigDecimal(b), DEFAULT_PRECISION);
	}
	
	
	
	public static void main(String[] args) {
//		System.out.println(formatMoney(new BigDecimal("12.456"), 2));
//		System.out.println(formatMoney(new BigDecimal("0"), 2));
	}

}
